home *** CD-ROM | disk | FTP | other *** search
- Path: fang.dsto.defence.gov.au!mrd186
- From: yenh@MRD.SRL.dsto.gov.au (Hung Yen)
- Newsgroups: comp.lang.c
- Subject: Please help!
- Date: Mon, 29 Jan 96 23:14:54 GMT
- Organization: Ericsson Defence Systems
- Distribution: world
- Message-ID: <4ehtt2$313@fang.dsto.defence.gov.au>
- NNTP-Posting-Host: mrd186.dsto.gov.au
- X-Newsreader: News Xpress Version 1.0 Beta #2
-
- Please take a look at this source code:
-
- #include <Xm/List.h>
- #include <stdio.h>
- /* Function to sort an array of integers into ascending order */
- void sort (a,n)
- int a[];
- int n;
- {
- int i,j,temp;
- for (i=0; i < n -1; ++i)
- for (j=i+1; j<n; ++j)
- if (a[i] > a[j])
- {
- temp = a[i];
- a[i] = a[j];
- a[j] = temp;
- }
-
- }
-
- int get_first_selected_plans(w,selected_count)
- Widget w;
- int selected_count;
- {
- int **position_list;
- int *position_count, first_selected_plan_number;
- Boolean Ok;
-
- if (!w){
- return 0;
- }
- Ok = XmListGetSelectedPos(w,position_list,position_count);
- sort(position_list,&position_count);
- first_selected_plan_number = position_list[1];
- return first_selected_plan_number;
- }
-
- This is my first try at C programming, so any help will be greatly appreciate.
-
- hung
-
-
-